<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layui</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" type="text/css" href="./layui/css/layui.css">
</head>
<body>

<div class="layui-btn-group demoTable" style="margin-bottom: 10px;">
    <button class="layui-btn" data-type="parseTable">立即转化为数据表格</button>
</div>

<table lay-filter="parse-table-demo">
    <thead>
        <tr>
            <th lay-data="{field:'username', width:200}">昵称</th>
            <th lay-data="{field:'joinTime', width:150, sort:true}">加入时间</th>
            <th lay-data="{field:'sign', minWidth: 180}">签名</th>
        </tr> 
    </thead>
    <tbody>
        <tr>
            <td>贤心1</td>
            <td>2016-11-28</td>
            <td>人生就像是一场修行 A</td>
        </tr>
        <tr>
            <td>贤心2</td>
            <td>2016-11-29</td>
            <td>人生就像是一场修行 B</td>
        </tr>
        <tr>
            <td>贤心3</td>
            <td>2016-11-30</td>
            <td>人生就像是一场修行 C</td>
        </tr>
    </tbody>
</table>


<script type="text/javascript" src="./layui/layui.js"></script>
<script type="text/javascript">
layui.use('table',function(){
    var table = layui.table;
    // var $ = layui.$;
    var active = {
        parseTable:function(){
            table.init('parse-table-demo',{
                height:'full-500',
            });
        }
    };
    var type = "parseTable";
    active[type] ? active[type].call(this) : '';
    // $('.demoTable .layui-btn').on('click', function(){
    //     var type = $(this).data('type');
    //     active[type] ? active[type].call(this) : '';
    // });
}); 
</script>

</body>
</html>